<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // var a;
      // console.log(a); // undefined
      // a = 1;
      // console.log(a);
      function print() {
        if (false) {
          console.log(xd); // 不报错，打印undefined
        }
        var xd = 'xdclass.net';
      }

      print();
    </script>
  </body>
</html>
